package com.xiongwei.manageback.authentication;

import cn.dev33.satoken.stp.StpInterface;
import com.xiongwei.manageback.mapper.SysUserMapper;
import com.xiongwei.manageback.utils.JwtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * sa-token实现鉴权
 */
@Component
public class StpInterfaceImpl implements StpInterface {

    @Autowired
    private SysUserMapper userMapper;

    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
//        根据当前登录用户id获取其拥有的所有权限
        return userMapper.getPermissions(loginId);
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
//        根据当前登录用户id获取其拥有的所有角色
        return userMapper.getRoles(loginId);
    }
}
